import request from '@/utils/request'

const prefix = '/user'
export function sendCodeService(data = {}) {
  return request({
    url: `${prefix}/sendCode`,
    method: 'post',
    data
  })
}

export function codeLoginService(data = {}) {
  return request({
    url: `${prefix}/code/login`,
    method: 'post',
    data
  })
}

export function logoutService() {
  return request({
    url: `${prefix}/logout`,
    method: 'delete',
  })
}

export function getUserInfoService() {
  return request({
    url: `${prefix}/info`,
    method: 'get',
  });
}

export function getUserDetailService() {
  return request({
    url: `${prefix}/detail`,
    method: 'get',
  })
}

export function updateUserService(data = {}) {
  return request({
    url: `${prefix}/edit`,
    method: 'put',
    data
  })
}

export function updateUserAvatarService(data = {}) {
  return request({
    url: `${prefix}/avatar/update`,
    method: 'put',
    data
  })
}